<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>人员列表</title>
    <link rel="stylesheet" href="${base}/static/res/manage/css/common.css">
    <link rel="stylesheet" href="${base}/static/res/manage/css/ec.css">
    <link rel="stylesheet" href="${base}/static/res/manage/css/list.css">
    <script type="text/javascript" src="${base}/static/res/plugin/jquery/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="${base}/static/res/plugin/validator/jquery.validate.min.js"></script>
    <script type="text/javascript" src="${base}/static/res/admin/js/common.js"></script>
    <script type="text/javascript" src="${base}/static/res/admin/js/list.js"></script>
    <script type="text/javascript" src="${base}/static/res/admin/js/scrollView.js"></script>
    <script type="text/javascript" src="${base}/static/res/admin/js/initWidth.js"></script>
    <script type="text/javascript" src="${base}/static/res/plugin/layer/layer.js"></script>
    <script type="text/javascript">
        $(function () {
[#--        [@flash_message /]--]

            $(".disabled,.launch").on("click", function () {
                var text = "";
                if ($(this).hasClass("launch")) {
                    text = "是否启用?";
                } else {
                    text = "是否禁用?";
                }
                if (confirm(text)) {
                    var id = $(this).attr("data-id");
                    var status = $(this).attr("data-status")
                    location.href = "easyUpdate.jhtml?id=" + id + "&status=" + status;
                }
            })
        });

        //重置密码
        function rePassword() {
            if (confirm("您确定要重置此人员密码吗？（重置后密码为admin123）")) {
                $.post(
                        "rePassword.jhtml",
                        {"id": "${admin.id}"},
                        function (data) {
                            if (data.success) {
                                $.message("success", "操作成功");
                            }
                        }
                );
            }
        }
    </script>
</head>
<body>
<div class="tab set">
    <h3>[#--<a href="javascript:;">首页</a>--]<a href="javascript:;">系统管理</a><a href="list.jhtml">> 人员管理</a></h3>
    <form id="listForm" action="list.jhtml" method="get">
        <div class="txte">
            <p class="txtl"><a href="add.jhtml" class="ared"> + 新建人员</a></p>
            <p class="txtp">
                <input type="text" name="userName" id="userName" value="${admin.userName}" placeholder="人员名称"
                       class="txt">
                <input type="text" name="mobile" id="mobile" value="${admin.mobile}" placeholder="手机号" class="txt">
                <input type="submit" value="搜索" class="txt red">
            </p>
        </div>
        <div class="tablist">
            <table cellpadding="0" cellspacing="0" class="scrollTable">
                <tr>
                    <th>人员名称</th>
                    <th>手机号</th>
                    <th>角色名称</th>
                    <th>是否可用</th>
                    <th>是否锁定</th>
                    <th>创建日期</th>
                    <th class="icon">操作</th>
                </tr>
            [#list page.list as admin]
                <tr>
                    <td>
                    ${admin.userName}
                    </td>
                    <td class="center">
                    ${admin.mobile}
                    </td>
                    <td class="center">
                    ${admin.roleNames}
                    </td>
                    <td class="center">
                    ${stdCodeName("ADMIN_STATUS",admin.status)}
                    </td>
                    <td class="center">
                    ${(admin.isLocked)?string('锁定','未锁定')}
                    </td>
                    <td class="center">
                        <span title="${admin.createDate?string("yyyy-MM-dd")}">${admin.createDate?string("yyyy-MM-dd")}</span>
                    </td>
                    <td class="icon">
                        [#if admin.id != 1]
                            <div>
                                <a id="rePassword" onclick="rePassword()">重置密码</a>
                                [#if admin.status == 0]
                                    <a class="disabled" title="禁用" data-id="${admin.id}" data-status="1"></a>
                                [#else]
                                    <a class="launch" title="解禁" data-id="${admin.id}" data-status="0"></a>
                                [/#if]
                                <a class="delete" title="删除" type="delOne" idName="id" idVal="${admin.id}"
                                   href="javascript:void(0)" title="删除"></a>
                                <a class="edit" href="edit.jhtml?id=${admin.id}" title="编辑"></a>
                                [#if admin.isLocked]<a class="unlock" title="解锁"
                                                       href="easyUpdate.jhtml?id=${admin.id}&isLocked=0"></a>[/#if]
                            </div>
                        [/#if]
                    </td>
                </tr>
            [/#list]
            </table>
[#--        [@pagination pageNumber = page.pageNumber totalPages = page.pages]--]
[#--            [#include "/intfc/include/pagination.ftl"]--]
[#--        [/@pagination]--]
        </div>
    </form>
</div>
</body>
</html>